VERSION 1.0 CLASS
BEGIN
  MultiUse = -1  'True
  Persistable = 0  'NotPersistable
  DataBindingBehavior = 0  'vbNone
  DataSourceBehavior  = 0  'vbNone
  MTSTransactionMode  = 0  'NotAnMTSObject
END
Attribute VB_Name = "ClsContrato"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
Option Explicit

'Clase de contrato

Public WithEvents orset As ClsRecordset
Attribute orset.VB_VarHelpID = -1

Public Event DataChanged()

'Miembros de la Clase

Public codigo As String
Public codCliente As String
Public codServicio As String
Public codMoneda As String
Public monto As Double
Public fecha_inicio As String
Public cantidad_ventas As Integer
Public descripcion As String

Public moneda As ClsMoneda
'fin declaracion miembros

'Constructor y Destructor
Private Sub Class_Initialize()
    Set orset = New ClsRecordset
    Set moneda = New ClsMoneda
    orset.setCampos concatenaVectores(dbCampos(cnt), dbCampos(mon))
    orset.setTablas Array(cnt, mon)
End Sub
Private Sub Class_Terminate()
    Set orset = Nothing
End Sub
' Generic Data management methods
Public Sub consulta()
    orset.consulta Array(cnt_mon_id & "=" & mon_id)
End Sub
Public Sub consultaCliente(clienteCod As String, servicioCod As String)
    orset.consulta Array(cnt_mon_id & "=" & mon_id, _
                         cnt_cli_id & "='" & clienteCod & "'", _
                         cnt_ser_id & "=" & servicioCod)
End Sub

Public Sub consultaDatos(codig As String)
    orset.consulta Array(cnt_mon_id & "=" & mon_id, _
                         cnt_id & "=" & codig)
    orset.CierraRec
End Sub

Public Sub agregaSalon(salonCod As String)
    orset.sInsertGral Array(cns_cnt_id, cns_sal_id), _
                      Array(Me.codigo, salonCod), _
                      Array(cns), False, False
End Sub
Public Sub quitaSalones()
    orset.sDeleteGral Array(cns), Array(cns_cnt_id & "=" & Me.codigo)
End Sub

Private Sub Reload_members()
    With orset
        codigo = .getDato(cnt_id)
        codCliente = .getDato(cnt_cli_id)
        codServicio = .getDato(cnt_ser_id)
        codMoneda = .getDato(cnt_mon_id)
        monto = .getDato(cnt_monto)
        fecha_inicio = .getDato(cnt_fecha_inicio)
        cantidad_ventas = .getDato(cnt_cantidad_ventas)
        descripcion = .getDato(cnt_descripcion)
        If .registrando Then
            moneda.consultaDatos codMoneda
            .registrando = False
        Else
            moneda.Reload_members orset
        End If
    End With
    RaiseEvent DataChanged
End Sub
Public Sub Nuevo(newCliId As String, newSerId As String, newMonId As String, newMonto As String, newFechaInicio As String, newCantidadVentas As String, newDescripcion As String)
    orset.sInsert Array("", newCliId, newSerId, newMonId, MascaraSQL(newMonto), newFechaInicio, newCantidadVentas, newDescripcion)
End Sub
Public Sub Modificar(codig As String, newCliId As String, newSerId As String, newMonId As String, newMonto As String, newFechaInicio As String, newCantidadVentas As String, newDescripcion As String)
    orset.sUpdate Array(codig, newCliId, newSerId, newMonId, MascaraSQL(newMonto), newFechaInicio, newCantidadVentas, newDescripcion)
End Sub
Public Sub Borrar(codig As String)
    consultaDatos codig
    quitaSalones
    orset.sDelete Array(cnt_id & "=" & codig)
End Sub

Private Sub orset_DataChanged()
    Reload_members
End Sub
